Drawing a background map is the first step of any geospatial analysis. Once this background is available, you can color each region to get a choropleth map, add points or bubble to get a bubble map, reshape the region to get a cartogram, or show connection with a connection map.
<!-- Include the CanvasXpress library in your HTML file -->
<link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/>
<script src="https://www.canvasxpress.org/canvasXpress.min.js"></script>
<!-- Create a canvas element for the chart with the desired dimensions -->
<div>
<canvas id="canvasId" width="600" height="600"</canvas>
</div>
<!-- Create a script to initialize the chart -->
<script>
<!-- Create the data for the graph -->
var data = false
<-- Create the configuration for the graph -->
var config = {
"decorations":{
"marker":[
{
"color":"blue",
"coords":[
40.701,
-73.985
],
"label":"New York 1",
"shape":"circle",
"size":1
},
{
"color":"red",
"coords":[
40.702,
-74.011
],
"label":"New York 2",
"shape":"teardrop",
"size":1.5
},
{
"color":"green",
"coords":[
40.703,
-73.991
],
"label":"New York 3",
"shape":"star",
"size":3
}
]
},
"graphType":"Map",
"mapConfig":{
"center":[
40.7,
-74
],
"zoom":15
},
"showLegend":"false",
"useLeaflet":"true"
}
<!-- Call the CanvasXpress function to create the graph -->
var cX = new CanvasXpress("canvasId", data, config);
</script>
library(canvasXpress) canvasXpress( data=FALSE, decorations=list(marker=list(list(color="blue", coords=list(40.701, -73.985), label="New York 1", shape="circle", size=1), list(color="red", coords=list(40.702, -74.011), label="New York 2", shape="teardrop", size=1.5), list(color="green", coords=list(40.703, -73.991), label="New York 3", shape="star", size=3))), graphType="Map", mapConfig=list(center=list(40.7, -74), zoom=15), showLegend=FALSE, useLeaflet=TRUE )
Create New Page